<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('goods', function (Blueprint $table) {
            $table->id();
            $table->bigInteger("category_id")->comment("商品分类ID");
            $table->string("name")->comment("商品名称");
            $table->decimal("price")->default(0)->comment("商品价格");
            $table->decimal("original_price")->default(0)->comment("商品原价");
            $table->string("unit")->default("件")->comment("商品单位");
            $table->decimal("purchase_cost_price")->default(0)->comment("进货成本");
            $table->decimal("sale_cost_price")->default(0)->comment("销售成本");
            $table->string("specification_status")->default(\App\Enums\GoodsSpecificationStatus::Single->value)->comment("规格状态");
            $table->string("specifications", 2048)->nullable()->comment("规格");
            $table->string("head_image")->nullable()->comment("商品头图");
            $table->string("images", 2048)->nullable()->comment("商品图片");
            $table->integer("point")->default(0)->comment("积分");
            $table->string("code")->nullable()->comment("商品条形码");
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('goods');
    }
};
